package org.eztouch.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

import org.eztouch.common.result.ResultUtil;
import org.eztouch.common.util.DataUtil;
import org.eztouch.service.SysUserClinet;
import org.eztouch.sys.entity.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@Api(value = "用户服务接口")
@RestController
@RequestMapping("/sysUser")
public class SysUserController {
	private static final Logger log = LoggerFactory.getLogger(SysUserController.class);
	
	@Autowired
	private SysUserClinet sysUserService;
	
	@ApiOperation(value = "测试Hello")
	//@ApiImplicitParam(name="authorization",value="header中的token数据",required=true,paramType="header",dataType="String")
	@RequestMapping(value = "/hello" ,method = RequestMethod.GET)
	public Object hello(@RequestParam String name){
		String str = sysUserService.hello(name);
		return ResultUtil.renderSuccess("请求成功！",str);
	}
	
	@ApiOperation(value = "用户详细信息")
	//@ApiImplicitParam(name="authorization",value="header中的token数据",required=true,paramType="header",dataType="String")
	@GetMapping(value = "/read/detail")
	public Object get(
			@ApiParam(value="要查看的用户ID",required=true)
			@RequestParam Long id) {
		if(DataUtil.isEmpty(id)){
			log.info("[用户详细信息]:用户ID为空！id="+id);
			return ResultUtil.renderError("[用户详细信息]:用户ID不能为空！");
		}
		SysUser su = sysUserService.selectById(id+"");
		return ResultUtil.renderSuccess(su);
	}
	
	
}
